<%@ page language="java"
	import="java.text.SimpleDateFormat,java.util.Date" pageEncoding="UTF-8"%>
<%@ page import="com.mobiusws.general.CellMapBean"%>

<%
float yy= 999;
float xx= 999;
String cellID =request.getParameter("cellId");
String strCellInfo=CellMapBean.DBQueryCellIDInfo(cellID);
int iValid=strCellInfo.length();
if(iValid>5)
{
	yy= Float.parseFloat(strCellInfo.split(";")[0]);
	xx= Float.parseFloat(strCellInfo.split(";")[1]);
}

%>

<html>
<head>

<title>CellID Location</title>
<script
	src="https://www.google.com/jsapi?key=ABQIAAAAvtat3apUqf1RsMNpunLGJRTBfUk9TZrBRaIteybtnU2KziHEpRQsPrmaojLxNm0LqiHxN9MTI_1AAw"
	type="text/javascript"></script>
<script type="text/javascript">
      var ge;
      var placemark;
      
      var validTag=<%=iValid%>;
      var latit=<%=yy%>;
      var longit=<%=xx%>;
      
      google.load("earth", "1");

      function init() {
         google.earth.createInstance('map3d', initCB, failureCB);
      }

      function initCB(instance) {
	      ge = instance;
          ge.getWindow().setVisibility(true);
          ge.getLayerRoot().enableLayerById(ge.LAYER_BORDERS, true);
          ge.getLayerRoot().enableLayerById(ge.LAYER_ROADS, false);
          ge.getNavigationControl().setVisibility(ge.VISIBILITY_SHOW);

          if(validTag>5)
        	  {
		          // Create the placemark and add it to Earth.
		          placemark = ge.createPlacemark('');
		          placemark.setName('CellID('+latit+", "+longit+")");
		          //placemark.setDescription('<table><tr><td>ID</td><td>12345</td></tr><tr><td>X</td><td>12.3</td></tr></table>');
		          
		          // Set the placemark's location.
		          var point = ge.createPoint('');
		          point.setLatitude(latit);
		          point.setLongitude(longit);
		          point.setAltitudeMode(ge.ALTITUDE_CLAMP_TO_GROUND);
		          placemark.setGeometry(point);
		
		          // Add the placemark to Earth.
		          ge.getFeatures().appendChild(placemark);
		
		          // Show the feature balloon.
		          //var balloon = ge.createFeatureBalloon('');
		          //balloon.setFeature(placemark);
		          //balloon.setMinWidth(400);
		          //ge.setBalloon(balloon);      
		          
		          // look at the placemark we created
		          var la = ge.createLookAt('');
		          la.set(latit, longit, 0, ge.ALTITUDE_RELATIVE_TO_GROUND, 0, 0, 2000000);
		          ge.getView().setAbstractView(la);   
        	  }

      }

      function failureCB(errorCode) {
      }

      google.setOnLoadCallback(init);
   </script>
</head>
<body>

	<div id="map3d"
		style="border: 1px solid silver; width: 750px; height: 570px;"></div>

</body>
</html>